package com.sumainfor.wx.tenant.controller;

import com.sumainfor.common.util.JsonResult;
import com.sumainfor.wx.tenant.feign.MarketFeignClient;
import com.sumainfor.wx.tenant.feign.OperationsFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * 功能描述:
 *
 * @Auther: zhlu
 * @Date: 2019/4/6 18:50
 * @Description:
 */
@RestController
@RequestMapping("/keep")
public class KeepController {

    @Autowired
    MarketFeignClient MarketFeignClient;

    @Autowired
    OperationsFeignClient OperationsFeignClient;


    /**
     * 功能描述: 
     * 根据租客编号获取租客合同，然后找房源管家
     * @Author zhlu
     * @Description //TODO
     * @Date 2019/4/6 18:52
     */
    @GetMapping("/getTenantKepp")
    public JsonResult getTenantKepp(@RequestParam Map<String,Object> params){
        return MarketFeignClient.getTenantKepp(params);
    }

    /**
     * 功能描述:
     * 获取管家评价的分类集合
     * @Author zhlu
     * @Description //TODO
     * @Date 2019/4/6 20:50
     */
    @GetMapping("/getEvaluateList")
    public JsonResult getEvaluateList(){
        JsonResult<Map<String, Object>> jsonResult = OperationsFeignClient.getEvaluateList();
        if (jsonResult.isSuccess() == false) {
            return jsonResult;
        }
        return jsonResult;
    }

    /**
     * 功能描述:
     * 租客联系管家记录
     * @Author zhlu
     * @Description //TODO
     * @Date 2019/4/6 20:52
     */
    @PostMapping("/AddTenantCallKeep")
    public JsonResult AddTenantCallKeep(@RequestBody Map<String,Object> params){
        JsonResult<Map<String, Object>> jsonResult = OperationsFeignClient.AddTenantCallKeep(params);
        if (jsonResult.isSuccess() == false) {
            return jsonResult;
        }
        return jsonResult;
    }

    /**
     * 功能描述:
     * 租客对管家评价
     * @Author zhlu
     * @Description //TODO
     * @Date 2019/4/6 20:54
     */
    @PostMapping("/AddTenantEvaKeep")
    public JsonResult AddTenantEvaKeep(@RequestBody Map<String,Object>params){
        JsonResult<Map<String, Object>> jsonResult = OperationsFeignClient.AddTenantEvaKeep(params);
        if (jsonResult.isSuccess() == false) {
            return jsonResult;
        }
        return jsonResult;
    }

}
